<?php

class Dashboard_IndexSuccessView extends SrsDashboardBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$this->setupHtml($rd);

		$halls = Doctrine_Query::create()->from('Hall')->orderBy('name ASC')->fetchArray();

		$reservations = Doctrine_Query::create()
			->select('r.id, r.fromTime, r.toTime, r.hallId, h.name AS hall, r.status')
			->from('Reservation r')
			->innerJoin('r.Hall h')
			->where('r.creatorId = ?', array($this->user->getCurrentUser()->id))
			->orderBy('r.createdAt DESC')
			->limit(10)
     	->fetchArray();

  	$this->setAttributes(array(
			'halls' => $halls,
			'reservations' => $reservations,
		));
 	}
}